package test.y2020;

import cn.hutool.core.lang.Console;
import com.google.common.collect.Maps;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2020/3/30 13:22
 */
public class March7 {
    public static void main(String[] args) {
        Console.error(arithmetic(20));
        Boolean o = Boolean.TRUE;
        List list;
        if (o) {
            list = new ArrayList();
        } else {
            list = new LinkedList();
        }
        la(list);

        Console.error(hash(2));

    }

    /* 如果try中有 return ， 会在执行 这个 return之前先执行 finally，可能最终返回的值会被finally覆盖 */

    private static int arithmetic(int num) {
        try {
            return num * num;
        } finally {
            if (num > 10) {
                return num;
            }
        }
    }

    private static void la(List<? extends Comparable<? super Object>> list) {
        Map<String, Boolean> map = Maps.newConcurrentMap();
        final List<? extends Comparable<? super Object>> i的元素 = list.stream().filter(i -> map.putIfAbsent("i的元素", true)).collect(Collectors.toList());
        Console.error(i的元素);
    }

    private static int hash(int h) {

        System.out.println(h >> 2);
        System.out.println(h << 2);

        h ^= (h >>> 20) ^ (h >>> 12);
        return h ^ (h >>> 7) ^ (h >>> 4);
    }
}
